home *** CD-ROM | disk | FTP | other *** search
/ Australian Personal Computer 2002 November / CD 1 / APC0211D1.ISO / workshop / prog / files / ActivePerl-5.6.1.633-MSWin32.msi / _567bb08195098bf74c78d591715500f4 < prev    next >
Encoding:
Text File  |  2002-05-01  |  918 b   |  39 lines

  1. package PPM::Repository::Local;
  2.  
  3. use strict;
  4. use PPM::PPD;
  5. use PPM::Search;
  6. use PPM::Result qw(Ok Warning Error List);
  7.  
  8. use Data::Dumper;
  9.  
  10. use base qw(PPM::Repository::WWW);
  11. use vars qw($VERSION);
  12. $VERSION = '3.05';
  13.  
  14. sub init {
  15.     my $o = shift;
  16.     my $base = $o->{url_base};
  17.     $base->scheme('file') unless $base->scheme;
  18.     $base->host('localhost') unless $base->host;
  19.     $o->{url} = $o->{url_base};
  20. }
  21.  
  22. sub load_pkg {
  23.     my $o = shift;
  24.     my $target = shift;
  25.     my $pkg = shift;
  26.     return Ok()
  27.         if exists $o->{ppds}{$pkg} and $o->{ppds}{$pkg}->is_complete;
  28.     my $file = "$o->{dir}/$pkg";
  29.     $file .= ".ppd" unless $file =~ /\.ppd$/i;
  30.     unless (-f $file) {
  31.     return Error("Package '$pkg' not found. "
  32.              . "Please 'search' for it first.");
  33.     }
  34.     $o->{ppds}{$pkg} = PPM::PPD->new($file, $o, $pkg);
  35.     Ok();
  36. }
  37.  
  38. sub type_printable { "Local directory" }
  39.